//
//  TableBarTouchView.m
//  PetAPP
//
//  Created by dllo on 16/1/22.
//  Copyright © 2016年 Yuming. All rights reserved.
//

#import "TableBarTouchView.h"


@interface TableBarTouchView ()

@property (nonatomic, copy) void(^block)(TableBarTouchView *view);



@end


@implementation TableBarTouchView

- (instancetype)initWithFrame:(CGRect)frame image:(NSString *)image {
    
    self = [super initWithFrame:frame];
    if (self) {
        CGRect newFrame = (CGRect){.size = frame.size};
        self.imageView = [[UIImageView alloc] initWithFrame:newFrame];
        self.imageName = image;
        self.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@1",self.imageName]];
        [self addSubview:self.imageView];
        [_imageView release];
        
    }
    return self;
}

- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    self.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@2",self.imageName]];
    self.block(self);
    
}

-(void)passTag:(void (^)(TableBarTouchView *view))block {

    self.block = block;
}

- (void)dealloc {
    [_imageName release];
    [_imageView release];
    [super dealloc];

}

@end
